#pragma once

class ZStream;

enum EFormationRole
{
	GoalkeeperRole = 0,
	DefenderRole,
	MidfieldRole,
	AttackerRole,
	NUM_FORMATION_ROLES
};

enum ESkillRole
{
	Goalkeeper = 0,
	Defender,
	Attacker,
	NUM_SKILL_ROLES
};

enum ETrainerRoles
{
	TrNone			= 0,
	TrGoalKeeper	= 1 << Goalkeeper,
	TrDefender		= 1 << Defender,
	TrAttacker		= 1 << Attacker,
	TrCoach			= 1 << NUM_SKILL_ROLES,
};

enum EMentalSkills
{
	Charisma = 0,
	Intelligence,
	Aggressivity,
	NUM_MEN_SKILLS
};

enum EPhysicsSkills
{
	Resistance = 0,
	Stamina,
	Fatigue,
	NUM_PHY_SKILLS
};

enum EPeoplStatus
{
	StatusRetired = 0x0,
	StatusPlayer = 0x1,
	StatusTrainer = 0x2,
	StatusPlayerOrTrainer = StatusPlayer | StatusTrainer
};

struct RoleSkills
{
	void Serialize(ZStream& o_stream) const;
	void Deserialize(ZStream& i_stream);

	void CalculateBestRole();
	void SetRole(const int i_role);
	int GetAverageSkills() const;

	int& operator[](const int i_index){return m_skills[i_index];}
	const int& operator[](const int i_index) const {return m_skills[i_index];}

	int m_skills[NUM_SKILL_ROLES];
	int m_bestRole;
};

struct PeopleSkills
{
	void Serialize(ZStream& o_stream) const;
	void Deserialize(ZStream& i_stream);

	void Generate(const bool i_isPlayer);

	RoleSkills m_playerSkills;
	RoleSkills m_maxPlayerSkills;
	RoleSkills m_trainerSkills;
	int m_mentalSkills[NUM_MEN_SKILLS];
	int m_physicsSkills[NUM_PHY_SKILLS];
};

class PlayerAvailability
{
public:
	PlayerAvailability(){Clear();}
	void Clear();

	void Serialize(ZStream& o_stream) const;
	void Deserialize(ZStream& i_stream);

	//Discipline
	void SetDaysExpulsion(const int i_daysExpulsion) {m_daysExpulsion = i_daysExpulsion;}
	void IncDaysExpulsion(int i_howMuch) {m_daysExpulsion += i_howMuch;}
	void DecDaysExpulsion() {if(m_daysExpulsion!=0)--m_daysExpulsion;}
	int GetDaysExpulsion() const {return m_daysExpulsion;}
	bool IsExpulse() const {return m_daysExpulsion != 0;}

	//Injury
	bool IsBroken() const {return m_daysBroken != 0;}
	int GetDaysBroken() const {return m_daysBroken;}
	void InjuryHeal() {if (m_daysBroken > 0)--m_daysBroken;}

	friend class People;
private:
	int m_daysExpulsion;
	int m_daysBroken;
};

struct PeopleParams
{
	int		max_skill_value; 
	size_t	MAX_CHAR_NAME;
	size_t	MIN_SKILL_VALUE;
	int		DAILY_FATIGUE_RECOVER;
	int		FATIGUE_UPDATE[NUM_FORMATION_ROLES+1];
#ifdef DARIO
	int		SELL_FACTOR;
	int		BUY_FACTOR;
#endif
};


